<div class="page-body">
    <div class="row">
        <div class="widget">
            <div class="widget-header
            <switch name="T_type">
            <case value="1">bg-magenta</case>
            <case value="2">bg-palegreen</case>
            <case value="3">bg-lightred</case>
            <case value="4">bg-blue</case>
            <case value="5">bg-blueberry</case>
            <case value="6">bg-gold</case>
            <default />bg-magenta
            </switch>
                                ">
            <span class="widget-caption">{$T_title|default=CONTROLLER_NAME}</span>
                                <!--Widget Buttons-->
        </div>
            <div class="widget-body">
                <div id="horizontal-form">
                    <form class="form-horizontal form_buy" role="form"
                          action="{:U('doDelay')}"
                          method="post" enctype="multipart/form-data" onSubmit="return false;">
                        <div class="form-group">
                            <label for="card_id" class="col-sm-3 control-label no-padding-right">会员卡：</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" id="card_id" name="card_id" value="" onkeydown="getCard()" required>
                                <div id="card_info" style="display:none;">
                                    <span class="info"></span><br>
                                    购书折扣：<span class="discount_buy"></span><br>
                                    活动报名费折扣：<span class="discount_apply"></span><br>
                                    借阅可免运费次数：<span class="num_delivery"></span><br>
                                    活动报名费可免次数：<span class="num_activity"></span><br>
                                </div>
                            </div>
                        </div>
                        <hr>
                        <div class="form-group   ">
                            <label class="col-sm-3 control-label no-padding-right"></label>
                            <div class="col-sm-3">
                                <ul class="type_info">

                                </ul>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="delay_time" class="col-sm-3 control-label no-padding-right">冻结时间：</label>
                            <div class="input-group col-sm-3">
                                    <span class="input-group-addon">
                                        <i class="fa fa-calendar"></i>
                                    </span>
                                <input type="text" class="form-control active" name="delay_time" id="delay_time" value="">
                            </div>
                        </div>
                        <div class="form-group  ">
                            <div class="col-sm-offset-3 col-sm-10">
                                <p class="label label-darkpink graded error_info"></p><br>
                                <input type="button" class="btn btn-primary" value="延期" onkeypress="FSubmit()" onclick="delay()">
                                <input type="button" class="btn btn-primary" value="取消延期" onkeypress="FSubmit()" onclick="undelay()">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/admin/js/datetime/moment.js"></script>
<script src="/admin/js/datetime/daterangepicker.js"></script>
<script>

    $('#delay_time').daterangepicker({
        format: "YYYY-MM-DD",
        separator: "~",
        locale: {
            applyLabel: '确定',
            cancelLabel: '取消',
            fromLabel: '开始时间',
            toLabel: '结束时间'
        }
    });

    function getsuccess(){

    }

    function cal_all(){

    }
    //延期
    function delay(){
        getCard_post();
        if (!confirm('确认操作?')) {
            return;
        }
        var $delay_time=$("input[name=delay_time]").val();
        var $card_id=$("#card_id").val();

        if ($("#user_id").val() == "") {
            $(".error_info").html("请输入有效卡号");
            return;
        }
        if ($delay_time == "") {
            $(".error_info").html("请输入冻结日期");
            return;
        }

        $.post("{:U('doDelay')}",{"card_id":$card_id,"delay_time":$delay_time},function(data){
            if (data.status == "error") {
                getCard_post();
                $(".error_info").html(data.data);
            }else {
                getCard_post();
                $(".error_info").html(data.data);
            }
        },"json");
    }
    //取消延期
    function undelay(){
        getCard_post();
        if (!confirm('确认操作?')) {
            return;
        }
        var $card_id=$("#card_id").val();

        if ($("#user_id").val() == "") {
            $(".error_info").html("请输入有效卡号");
            return;
        }

        $.post("{:U('doUndelay')}",{"card_id":$card_id},function(data){
            getCard_post();
            $(".error_info").html(data.data);
        },"json");
    }
</script>